<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of StatementAbuseController
 *
 * @author tuancasi
 */
class StatementabuseController extends Controller {
    //put your code here

    /**
     * Manage statement 
     */
    public function actionIndex() {
	$model = new StatementAbuse('search');
	$model->unsetAttributes();  // clear any default values
	if (isset($_GET['StatementAbuse'])) {
	    $model->attributes = $_GET['StatementAbuse'];
	}
	$this->render('index', array(
	    'model' => $model
	));
    }

    /**
     * Manage statement 
     */
    public function actionAdd() {
	$model = new StatementAbuse();

	if (isset($_POST['submit'])) {
	    $model->attributes = $_POST['StatementAbuse'];
	    if ($model->validate()) {
		$model->time_created = date('Y-m-d', time());
		$model->save();
		$this->redirect(BACKEND_SITE_URL . 'statementabuse');
	    }
	}
	$this->render('add', array(
	    'model' => $model
	));
    }

    /**
     * delete statement
     */
    public function actionDelete() {
	if (isset($_GET['id'])) {
	    $model = StatementAbuse::model()->findByPk($_GET['id'])->delete();
	}
    }

}

